#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:do_gloabl.py
# author:张世航
# datetime:2024/11/1 10:28
# software: PyCharm
"""
this is function  description 
"""
# import module your need

# num = 10
# def demo1():
#     print(num)
#
# def demo2():
#     print(num)
#
# demo1()
# demo2()
#
# print("over")


# num = 10
#
# def demo1():
#     print("demo1" + "-" * 50)
#
#     # 只是定义了一个局部变量，不会修改到全局变量，只是变量名相同而已
#     num = 100
#     print(num)
#
#
# def demo2():
#     print("demo2" + "-" * 50)
#     print(num)
#
# demo1()
# demo2()
#
# print("over")


num = 1
def fun1():
    global num  # 需要使用 global 关键字声明
    print(num)
    num = 123
    print(num)
fun1()
print(num)